#ifndef CS_SERVER_H
#define CS_SERVER_H

#include <cstdlib>
#include <deque>
#include <iostream>
#include <list>
#include <boost\bind.hpp>
#include <boost\shared_ptr.hpp>
#include <boost\asio.hpp>
#include <boost\thread.hpp>
#include <utils\logger.h>

#include "session.h"
#include "registry.h"
#include "message.h"

namespace cs
{
	class server
	{
	public:
		server();
		void run();
		void stop();
		~server();

	private:
		typedef boost::asio::ip::tcp boost_asio_tcp;
		typedef boost::shared_ptr<boost::thread> thread_t;
		typedef boost::shared_ptr<session> session_ptr;

		void start_accept();
		void handle_accept(session_ptr session, 
			const boost::system::error_code& error);

		thread_t thread;
		boost::asio::io_service io_service_;
		boost::shared_ptr<boost_asio_tcp::acceptor> acceptor_;
		utils::logger logger;
	};
}
#endif